Integrand size = 38, antiderivative size = 175 \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=\frac {\left (a^3 B-3 a b^2 B+3 a^2 b C-b^3 C\right ) x}{\left (a^2+b^2\right )^3}+\frac {\left (3 a^2 b B-b^3 B-a^3 C+3 a b^2 C\right ) \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right )^3 d}-\frac {b B-a C}{2 \left (a^2+b^2\right ) d (a+b \tan (c+d x))^2}-\frac {2 a b B-a^2 C+b^2 C}{\left (a^2+b^2\right )^2 d (a+b \tan (c+d x))} \]
[Out]
Time = 0.38 (sec) , antiderivative size = 175, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.105, Rules used = {3713, 3610, 3612, 3611} \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=-\frac {b B-a C}{2 d \left (a^2+b^2\right ) (a+b \tan (c+d x))^2}-\frac {a^2 (-C)+2 a b B+b^2 C}{d \left (a^2+b^2\right )^2 (a+b \tan (c+d x))}+\frac {\left (a^3 (-C)+3 a^2 b B+3 a b^2 C-b^3 B\right ) \log (a \cos (c+d x)+b \sin (c+d x))}{d \left (a^2+b^2\right )^3}+\frac {x \left (a^3 B+3 a^2 b C-3 a b^2 B-b^3 C\right )}{\left (a^2+b^2\right )^3} \]
[In]
[Out]
Rule 3610
Rule 3611
Rule 3612
Rule 3713
Rubi steps \begin{align*} \text {integral}& = \int \frac {B+C \tan (c+d x)}{(a+b \tan (c+d x))^3} \, dx \\ & = -\frac {b B-a C}{2 \left (a^2+b^2\right ) d (a+b \tan (c+d x))^2}+\frac {\int \frac {a B+b C-(b B-a C) \tan (c+d x)}{(a+b \tan (c+d x))^2} \, dx}{a^2+b^2} \\ & = -\frac {b B-a C}{2 \left (a^2+b^2\right ) d (a+b \tan (c+d x))^2}-\frac {2 a b B-a^2 C+b^2 C}{\left (a^2+b^2\right )^2 d (a+b \tan (c+d x))}+\frac {\int \frac {a^2 B-b^2 B+2 a b C-\left (2 a b B-a^2 C+b^2 C\right ) \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{\left (a^2+b^2\right )^2} \\ & = \frac {\left (a^3 B-3 a b^2 B+3 a^2 b C-b^3 C\right ) x}{\left (a^2+b^2\right )^3}-\frac {b B-a C}{2 \left (a^2+b^2\right ) d (a+b \tan (c+d x))^2}-\frac {2 a b B-a^2 C+b^2 C}{\left (a^2+b^2\right )^2 d (a+b \tan (c+d x))}+\frac {\left (3 a^2 b B-b^3 B-a^3 C+3 a b^2 C\right ) \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{\left (a^2+b^2\right )^3} \\ & = \frac {\left (a^3 B-3 a b^2 B+3 a^2 b C-b^3 C\right ) x}{\left (a^2+b^2\right )^3}+\frac {\left (3 a^2 b B-b^3 B-a^3 C+3 a b^2 C\right ) \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right )^3 d}-\frac {b B-a C}{2 \left (a^2+b^2\right ) d (a+b \tan (c+d x))^2}-\frac {2 a b B-a^2 C+b^2 C}{\left (a^2+b^2\right )^2 d (a+b \tan (c+d x))} \\ \end{align*}
Result contains complex when optimal does not.
Time = 4.74 (sec) , antiderivative size = 243, normalized size of antiderivative = 1.39 \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=-\frac {C \left (\frac {i \log (i-\tan (c+d x))}{(a+i b)^2}-\frac {i \log (i+\tan (c+d x))}{(a-i b)^2}+\frac {2 b \left (-2 a \log (a+b \tan (c+d x))+\frac {a^2+b^2}{a+b \tan (c+d x)}\right )}{\left (a^2+b^2\right )^2}\right )+(b B-a C) \left (\frac {i \log (i-\tan (c+d x))}{(a+i b)^3}-\frac {\log (i+\tan (c+d x))}{(i a+b)^3}+\frac {b \left (\left (-6 a^2+2 b^2\right ) \log (a+b \tan (c+d x))+\frac {\left (a^2+b^2\right ) \left (5 a^2+b^2+4 a b \tan (c+d x)\right )}{(a+b \tan (c+d x))^2}\right )}{\left (a^2+b^2\right )^3}\right )}{2 b d} \]
[In]
[Out]
Time = 0.50 (sec) , antiderivative size = 208, normalized size of antiderivative = 1.19
method | result | size |
derivativedivides | \(\frac {\frac {\frac {\left (-3 B \,a^{2} b +B \,b^{3}+C \,a^{3}-3 C a \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (B \,a^{3}-3 B a \,b^{2}+3 C \,a^{2} b -C \,b^{3}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}+\frac {\left (3 B \,a^{2} b -B \,b^{3}-C \,a^{3}+3 C a \,b^{2}\right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}-\frac {B b -C a}{2 \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (d x +c \right )\right )^{2}}-\frac {2 B a b -C \,a^{2}+C \,b^{2}}{\left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (d x +c \right )\right )}}{d}\) | \(208\) |
default | \(\frac {\frac {\frac {\left (-3 B \,a^{2} b +B \,b^{3}+C \,a^{3}-3 C a \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (B \,a^{3}-3 B a \,b^{2}+3 C \,a^{2} b -C \,b^{3}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}+\frac {\left (3 B \,a^{2} b -B \,b^{3}-C \,a^{3}+3 C a \,b^{2}\right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}-\frac {B b -C a}{2 \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (d x +c \right )\right )^{2}}-\frac {2 B a b -C \,a^{2}+C \,b^{2}}{\left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (d x +c \right )\right )}}{d}\) | \(208\) |
parallelrisch | \(\frac {6 a \left (B \,a^{2} b -\frac {1}{3} B \,b^{3}-\frac {1}{3} C \,a^{3}+C a \,b^{2}\right ) \left (a +b \tan \left (d x +c \right )\right )^{2} \ln \left (a +b \tan \left (d x +c \right )\right )-3 a \left (B \,a^{2} b -\frac {1}{3} B \,b^{3}-\frac {1}{3} C \,a^{3}+C a \,b^{2}\right ) \left (a +b \tan \left (d x +c \right )\right )^{2} \ln \left (\sec \left (d x +c \right )^{2}\right )+2 b^{2} \left (\left (B d x -\frac {C}{2}\right ) a^{4}+b \left (3 C d x +B \right ) a^{3}-3 B x \,a^{2} b^{2} d +b^{3} \left (-C d x +B \right ) a +\frac {C \,b^{4}}{2}\right ) \tan \left (d x +c \right )^{2}+4 a^{2} b d x \left (B \,a^{3}-3 B a \,b^{2}+3 C \,a^{2} b -C \,b^{3}\right ) \tan \left (d x +c \right )+2 a \left (\left (B d x +C \right ) a^{5}-\frac {3 a^{4} \left (-2 C d x +B \right ) b}{2}-3 b^{2} \left (B d x -\frac {C}{3}\right ) a^{3}-2 b^{3} \left (\frac {C d x}{2}+B \right ) a^{2}-\frac {B \,b^{5}}{2}\right )}{2 \left (a^{2}+b^{2}\right )^{3} a d \left (a +b \tan \left (d x +c \right )\right )^{2}}\) | \(302\) |
norman | \(\frac {\frac {\left (B \,a^{3}-3 B a \,b^{2}+3 C \,a^{2} b -C \,b^{3}\right ) a^{2} x}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (a^{2}+b^{2}\right )}+\frac {b^{2} \left (B \,a^{3}-3 B a \,b^{2}+3 C \,a^{2} b -C \,b^{3}\right ) x \tan \left (d x +c \right )^{2}}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (a^{2}+b^{2}\right )}-\frac {3 B \,a^{2} b^{2}+B \,b^{4}-2 C \,a^{3} b}{2 b d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {b \left (2 B a \,b^{2}-C \,a^{2} b +C \,b^{3}\right ) \tan \left (d x +c \right )^{2}}{2 d a \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {2 b \left (B \,a^{3}-3 B a \,b^{2}+3 C \,a^{2} b -C \,b^{3}\right ) a x \tan \left (d x +c \right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (a^{2}+b^{2}\right )}}{\left (a +b \tan \left (d x +c \right )\right )^{2}}+\frac {\left (3 B \,a^{2} b -B \,b^{3}-C \,a^{3}+3 C a \,b^{2}\right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {\left (3 B \,a^{2} b -B \,b^{3}-C \,a^{3}+3 C a \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}\) | \(437\) |
risch | \(-\frac {x B}{3 i a^{2} b -i b^{3}-a^{3}+3 a \,b^{2}}+\frac {i x C}{3 i a^{2} b -i b^{3}-a^{3}+3 a \,b^{2}}-\frac {6 i B \,a^{2} b x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}+\frac {2 i B \,b^{3} x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}+\frac {2 i C \,a^{3} x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}-\frac {6 i C a \,b^{2} x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}-\frac {6 i B \,a^{2} b c}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {2 i B \,b^{3} c}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {2 i C \,a^{3} c}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {6 i C a \,b^{2} c}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {2 b \left (-2 i B a \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+i C \,a^{2} b \,{\mathrm e}^{2 i \left (d x +c \right )}-i C \,b^{3} {\mathrm e}^{2 i \left (d x +c \right )}+3 B \,a^{2} b \,{\mathrm e}^{2 i \left (d x +c \right )}+B \,b^{3} {\mathrm e}^{2 i \left (d x +c \right )}-2 C \,a^{3} {\mathrm e}^{2 i \left (d x +c \right )}+3 i B a \,b^{2}-2 i C \,a^{2} b +i C \,b^{3}+3 B \,a^{2} b -2 C \,a^{3}+C a \,b^{2}\right )}{\left (b \,{\mathrm e}^{2 i \left (d x +c \right )}+i a \,{\mathrm e}^{2 i \left (d x +c \right )}-b +i a \right )^{2} \left (-i a +b \right )^{2} d \left (i a +b \right )^{3}}+\frac {3 a^{2} b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B \,b^{3}}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) C}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) C a \,b^{2}}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}\) | \(793\) |
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 482 vs. \(2 (171) = 342\).
Time = 0.28 (sec) , antiderivative size = 482, normalized size of antiderivative = 2.75 \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=\frac {5 \, C a^{3} b^{2} - 7 \, B a^{2} b^{3} - C a b^{4} - B b^{5} + 2 \, {\left (B a^{5} + 3 \, C a^{4} b - 3 \, B a^{3} b^{2} - C a^{2} b^{3}\right )} d x - {\left (3 \, C a^{3} b^{2} - 5 \, B a^{2} b^{3} - 3 \, C a b^{4} + B b^{5} - 2 \, {\left (B a^{3} b^{2} + 3 \, C a^{2} b^{3} - 3 \, B a b^{4} - C b^{5}\right )} d x\right )} \tan \left (d x + c\right )^{2} - {\left (C a^{5} - 3 \, B a^{4} b - 3 \, C a^{3} b^{2} + B a^{2} b^{3} + {\left (C a^{3} b^{2} - 3 \, B a^{2} b^{3} - 3 \, C a b^{4} + B b^{5}\right )} \tan \left (d x + c\right )^{2} + 2 \, {\left (C a^{4} b - 3 \, B a^{3} b^{2} - 3 \, C a^{2} b^{3} + B a b^{4}\right )} \tan \left (d x + c\right )\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - 2 \, {\left (2 \, C a^{4} b - 3 \, B a^{3} b^{2} - 3 \, C a^{2} b^{3} + 3 \, B a b^{4} + C b^{5} - 2 \, {\left (B a^{4} b + 3 \, C a^{3} b^{2} - 3 \, B a^{2} b^{3} - C a b^{4}\right )} d x\right )} \tan \left (d x + c\right )}{2 \, {\left ({\left (a^{6} b^{2} + 3 \, a^{4} b^{4} + 3 \, a^{2} b^{6} + b^{8}\right )} d \tan \left (d x + c\right )^{2} + 2 \, {\left (a^{7} b + 3 \, a^{5} b^{3} + 3 \, a^{3} b^{5} + a b^{7}\right )} d \tan \left (d x + c\right ) + {\left (a^{8} + 3 \, a^{6} b^{2} + 3 \, a^{4} b^{4} + a^{2} b^{6}\right )} d\right )}} \]
[In]
[Out]
Exception generated. \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=\text {Exception raised: AttributeError} \]
[In]
[Out]
none
Time = 0.32 (sec) , antiderivative size = 321, normalized size of antiderivative = 1.83 \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=\frac {\frac {2 \, {\left (B a^{3} + 3 \, C a^{2} b - 3 \, B a b^{2} - C b^{3}\right )} {\left (d x + c\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {2 \, {\left (C a^{3} - 3 \, B a^{2} b - 3 \, C a b^{2} + B b^{3}\right )} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {{\left (C a^{3} - 3 \, B a^{2} b - 3 \, C a b^{2} + B b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {3 \, C a^{3} - 5 \, B a^{2} b - C a b^{2} - B b^{3} + 2 \, {\left (C a^{2} b - 2 \, B a b^{2} - C b^{3}\right )} \tan \left (d x + c\right )}{a^{6} + 2 \, a^{4} b^{2} + a^{2} b^{4} + {\left (a^{4} b^{2} + 2 \, a^{2} b^{4} + b^{6}\right )} \tan \left (d x + c\right )^{2} + 2 \, {\left (a^{5} b + 2 \, a^{3} b^{3} + a b^{5}\right )} \tan \left (d x + c\right )}}{2 \, d} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 409 vs. \(2 (171) = 342\).
Time = 1.25 (sec) , antiderivative size = 409, normalized size of antiderivative = 2.34 \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=\frac {\frac {2 \, {\left (B a^{3} + 3 \, C a^{2} b - 3 \, B a b^{2} - C b^{3}\right )} {\left (d x + c\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {{\left (C a^{3} - 3 \, B a^{2} b - 3 \, C a b^{2} + B b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {2 \, {\left (C a^{3} b - 3 \, B a^{2} b^{2} - 3 \, C a b^{3} + B b^{4}\right )} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{6} b + 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} + b^{7}} + \frac {3 \, C a^{3} b^{2} \tan \left (d x + c\right )^{2} - 9 \, B a^{2} b^{3} \tan \left (d x + c\right )^{2} - 9 \, C a b^{4} \tan \left (d x + c\right )^{2} + 3 \, B b^{5} \tan \left (d x + c\right )^{2} + 8 \, C a^{4} b \tan \left (d x + c\right ) - 22 \, B a^{3} b^{2} \tan \left (d x + c\right ) - 18 \, C a^{2} b^{3} \tan \left (d x + c\right ) + 2 \, B a b^{4} \tan \left (d x + c\right ) - 2 \, C b^{5} \tan \left (d x + c\right ) + 6 \, C a^{5} - 14 \, B a^{4} b - 7 \, C a^{3} b^{2} - 3 \, B a^{2} b^{3} - C a b^{4} - B b^{5}}{{\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )} {\left (b \tan \left (d x + c\right ) + a\right )}^{2}}}{2 \, d} \]
[In]
[Out]
Time = 8.56 (sec) , antiderivative size = 279, normalized size of antiderivative = 1.59 \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=\frac {\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )\,\left (\frac {3\,B\,b-C\,a}{{\left (a^2+b^2\right )}^2}-\frac {4\,b^2\,\left (B\,b-C\,a\right )}{{\left (a^2+b^2\right )}^3}\right )}{d}-\frac {\frac {-3\,C\,a^3+5\,B\,a^2\,b+C\,a\,b^2+B\,b^3}{2\,\left (a^4+2\,a^2\,b^2+b^4\right )}+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-C\,a^2\,b+2\,B\,a\,b^2+C\,b^3\right )}{a^4+2\,a^2\,b^2+b^4}}{d\,\left (a^2+2\,a\,b\,\mathrm {tan}\left (c+d\,x\right )+b^2\,{\mathrm {tan}\left (c+d\,x\right )}^2\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-C+B\,1{}\mathrm {i}\right )}{2\,d\,\left (-a^3-a^2\,b\,3{}\mathrm {i}+3\,a\,b^2+b^3\,1{}\mathrm {i}\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B-C\,1{}\mathrm {i}\right )}{2\,d\,\left (-a^3\,1{}\mathrm {i}-3\,a^2\,b+a\,b^2\,3{}\mathrm {i}+b^3\right )} \]
[In]
[Out]